#!/bin/env python
#encoding:utf8
import ahocorasick
tree = ahocorasick.KeywordTree()
t1='上海'.decode('utf-8')
t2='海上'.decode('utf-8')
tree.add(t1)
tree.add(t2)
tree.make()

print tree.search('上海自来水来自海上')
